[#52] Sync → Ignore patterns - #70
Open
kwame-Owusu wants to merge 16 commits into
Open
Conversation
Contributor
|
@kwame-Owusu Thanks for the PR, will leave this for after the |
Contributor
Author
Cool 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #52
Feature
There's no way to exclude a folder or file pattern from sync, every file the vault reader sees becomes a candidate for push or pull. Users will want to keep some folders local only (a private notes folder, a large attachments folder) without excluding them from Obsidian entirely.
Needs a settings field for glob style ignore patterns, applied before takeSnapshot/planSync ever sees those paths.
Changes
Added the ability to exclude files and folders from sync via two layers:
local_convention, any path segment starting withlocal_is always excluded from sync, no configuration neededFiltering happens at the vault reader level so ignored files never enter the snapshot system. Previously-synced files that become ignored will appear as deletions and be cleaned from remote on next sync.
UI
Look of the UI in the settings tab for geod, users will be able to add their glob style patterns line by line. Similar to how we do in a .gitignore file.
Tests
Added new tests in
ignore.test.ts, and they all passGreptile Summary
This PR adds two-layer ignore filtering to the vault reader: a built-in
local_prefix convention and user-configurable glob patterns stored in settings and exposed via a new Sync section in the settings tab. Filtering happens at thecreateObsidianReaderlevel so ignored files never enter the snapshot or sync planning pipeline.src/ignore.tsprovideshasLocalPrefix,globToRegex,shouldIgnore, and pre-compilation helpers (compilePatterns,shouldIgnoreCompiled); all are well-tested insrc/ignore.test.ts.ignorePatternsto[], andsettingsEqualis extended for array comparison; previously-flagged UI bugs inrenderSyncSectionare resolved in this revision.createObsidianReadercall sites inmain.tsand the integration test pass the liveignorePatterns, so patterns take effect on the next sync immediately after save.Confidence Score: 5/5
settings.ts, which has no runtime impact.Important Files Changed
local_prefix convention.compilePatterns/shouldIgnoreCompiledare correctly exported for efficient pre-compiled use;shouldIgnorenow delegates through them.hasLocalPrefix,matchesGlob, andshouldIgnore. Edge cases like empty path, empty pattern,**in middle, and leading slash stripping are all exercised.ignorePatterns: string[]field with default, normalization, and equality support. Minor style issue: missing blank line betweenarraysEqualandsaveDraftcomment, inconsistent with the rest of the file.renderSyncSectionadds the Sync heading and a multiline textarea for ignore patterns. Previously flaggedsetDescargument bug is resolved; description now correctly explains thelocal_convention and theprivate/**folder idiom.ignorePatternsparameter tocreateObsidianReaderand filters ignored paths before pushing to the result set. Filtering happens at read time, so ignored files never enter the snapshot.createObsidianReadercall sites updated to passthis.settings.ignorePatterns. Because settings are updated synchronously bysaveDraft, patterns take effect on the next sync without any additional refresh step.ignorePatterns. Coverage is appropriate.liveSettings.ignorePatterns(defaults to[]) tocreateObsidianReader. No logic changes..geode-sync-anchormargin rule consistent with the existing.geode-support-anchorstyle.Reviews (11): Last reviewed commit: "Merge branch 'main' into feat/ignore-pat..." | Re-trigger Greptile
Context used: